﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;

namespace H2TWindowsForms
{
    public partial class Main : Form
    {
        //Hoang code
        H2TService.WebService1 service = new H2TService.WebService1();
        static int ord_num = 0;
        static DataTable db_product;
        static int ipage = 0;
        //end code
        public Main()
        {
            InitializeComponent();
            Frm_login frmlogin = new Frm_login();
            frmlogin.ShowDialog();
        }

        private void Llb_Checkout_LinkClicked(object sender, LinkLabelLinkClickedEventArgs e)
        {
            if (ord_num != 0)
            {

            }
            else {
                MessageBox.Show("You don't have product to check out !!!","Warning",MessageBoxButtons.OK);
            }
        }

        private void tab1_SelectedIndexChanged(object sender, EventArgs e)
        {
            switch(tab1.SelectedIndex)
                {
                    case 0: // onload for product here
                         { 

                         }
                         break;
                    case 1: // onload for catetgory here
                         {
                         }
                         break;
                    case 2: // onload for catetgory here
                         {
                             LoadProductToOrder();
                         }

                         break;
                }
        }

        #region "Hoang code"

        public void LoadProductToOrder()
        {
            ipage++;
            db_product = service.productForOrder(ipage, 5);
            GrdV_ProductOrd.DataSource = db_product;
            GrdV_ProductOrd.Columns[0].Visible = false;
            GrdV_ProductOrd.Columns[1].Visible = false;
        }

        private void btn_SearchOrder_Click(object sender, EventArgs e)
        {
            Frm_Search frmSearch = new Frm_Search();
            frmSearch.TypeOpen = "Order";
            frmSearch.ShowDialog();
        }

        #endregion


    }
}
